LearningDataModel.CreateInteraction Method

Creates a Interaction object, which may then be used to be added to the Interactions list.

Parent Type: LearningDataModel

Namespace: Microsoft.LearningComponents.DataModel

Assembly: Microsoft.LearningComponents.dll

Syntax
C#

public Interaction CreateInteraction ()

Return Value

A new Interaction object associated with this LearningDataModel.

Exceptions
Exception type Condition
InvalidOperationException

Thrown if this LearningDataModel object cannot be written to.

Example

The following example demonstrates creating a new interaction and adding it to the Interactions collection.

C#
LearningSession session = ... ; // get LearningSession object

Interaction i = session.CurrentActivityDataModel.CreateInteraction();
i.Id = "interaction1"; // A unique identifier is required before this is added to the list
i.InteractionType = InteractionType.TrueFalse;
session.CurrentActivityDataModel.Interactions.Add(i);